import request from '@/utils/request'

// 查询试题分类列表
export function listTopicCategory(query) {
  return request({
    url: '/exam/topicCategory/list',
    method: 'get',
    params: query
  })
}

// 查询试题分类详细
export function getTopicCategory(id) {
  return request({
    url: '/exam/topicCategory/' + id,
    method: 'get'
  })
}

// 新增试题分类
export function addTopicCategory(data) {
  return request({
    url: '/exam/topicCategory',
    method: 'post',
    data: data
  })
}

// 修改试题分类
export function updateTopicCategory(data) {
  return request({
    url: '/exam/topicCategory',
    method: 'put',
    data: data
  })
}

// 删除试题分类
export function delTopicCategory(id) {
  return request({
    url: '/exam/topicCategory/' + id,
    method: 'delete'
  })
}

//删除试题分类及其子分类
export function delTopicCategoryAndChild(id) {
  return request({
    url: '/exam/topicCategory/remove/' + id,
    method: 'delete'
  })
}

//根据分类Id获取分类名称
export function getTopicCategoryName(id) {
  return request({
    url: '/exam/topicCategory/getCategoryName/' + id,
    method: 'get'
  })
}

//获取分类树
export function getTopicCategoryTree(id) {
  return request({
    url: '/exam/topicCategory/tree/' + id,
    method: 'get'
  })
}